package com.ssy.lingxi.marketing.controller.web;

import cn.hutool.json.JSONObject;
import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.marketing.model.bo.MobileMerchantActivityGoodsCouponBO;
import com.ssy.lingxi.marketing.model.vo.activity.request.ActivityCardAdornReq;
import com.ssy.lingxi.marketing.model.vo.activity.request.GoodsAreaAdornReq;
import com.ssy.lingxi.marketing.model.vo.activity.response.ActivityCardAdornResp;
import com.ssy.lingxi.marketing.model.vo.activity.response.GoodsAreaAdornResp;
import com.ssy.lingxi.marketing.service.IWebActivityService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * @author fhj
 * @version 2.0.0
 * @menu web - 活动
 * @date 2021/09/03
 */
@RestController
@RequestMapping("/marketing/web/activity")
public class WebActivityController extends BaseController {

    @Resource
    private IWebActivityService webActivityService;

    /**
     * 平台活动页（装修展示）
     **/
    @RequestMapping(value = "/platformActivityPageAdorn", method = RequestMethod.POST)
    public Wrapper<Map<String, Object>> platformActivityPageAdorn(@RequestBody JSONObject req) {
        return webActivityService.platformActivityPageAdorn(req, getHeadersShopId(), isLogin() ? getSysUser() : null);
    }

    /**
     * 商家活动页（装修展示）
     **/
    @RequestMapping(value = "/merchantActivityPageAdorn", method = RequestMethod.POST)
    public Wrapper<Map<String, Object>> merchantActivityPageAdorn(@RequestBody JSONObject req) {
        return webActivityService.merchantActivityPageAdorn(req, getHeadersShopId(), isLogin() ? getSysUser() : null);
    }

    /**
     * 活动卡片（装修展示）
     **/
    @RequestMapping(value = "/activityCardAdorn", method = RequestMethod.GET)
    public Wrapper<List<ActivityCardAdornResp>> activityCardAdorn(@Valid ActivityCardAdornReq req) {
        return webActivityService.activityCardAdorn(req, getHeadersShopId(), isLogin() ? getSysUser() : null);
    }

    /**
     * 店铺活动卡片（装修展示）
     **/
    @RequestMapping(value = "/storeActivityCardAdorn", method = RequestMethod.GET)
    public Wrapper<List<ActivityCardAdornResp>> storeActivityCardAdorn(@Valid ActivityCardAdornReq req) {
        return webActivityService.storeActivityCardAdorn(req,getHeadersShopId(), isLogin() ? getSysUser() : null);
    }

    /**
     * 活动卡片 - 赠送优惠卷（装修展示）
     **/
    @RequestMapping(value = "/activityCardGiveCouponAdorn", method = RequestMethod.POST)
    public Wrapper<List<MobileMerchantActivityGoodsCouponBO>> activityCardGiveCouponAdorn(@RequestBody @Valid ActivityCardAdornReq req) {
        return webActivityService.activityCardGiveCouponAdorn(getSysUser(), getHeadersShopId(), req);
    }

    /**
     * 商品区（装修展示）
     **/
    @RequestMapping(value = "/goodsAreaAdorn", method = RequestMethod.GET)
    public Wrapper<PageData<GoodsAreaAdornResp>> goodsAreaAdorn(@Valid GoodsAreaAdornReq req) {
        return webActivityService.goodsAreaAdorn(req);
    }

    /**
     * 渠道商品区（装修展示）
     **/
    @RequestMapping(value = "/chancelGoodsAreaAdorn", method = RequestMethod.GET)
    public Wrapper<PageData<GoodsAreaAdornResp>> chancelGoodsAreaAdorn(@Valid GoodsAreaAdornReq req) {
        return webActivityService.chancelGoodsAreaAdorn(req);
    }
}
